import Vue from "vue";

import Cookies from "js-cookie";

// 引入字体包
import "./font/index.css";


import ElementUI from "element-ui";
import locale from "./locales/zh-chs.json";

import "./assets/styles/element-variables.scss";
import "@/views/task/easyflow/index.css";
import "@/assets/styles/index.scss"; // global css
import "@/assets/styles/ruoyi.scss"; // ruoyi css
import App from "./App";
import store from "./store";
import router from "./router";
import directive from "./directive"; //directive

// import locale from 'element/lib/locale/lang/zh-cn';//element中文



import VCharts from "v-charts";
// 核心插件
import d2Admin from "@/plugin/d2admin";
import echarts from "echarts";

//element样式
import Element from "element-ui";
import 'element-ui/lib/theme-chalk/index.css'
import elementZh from 'element-ui/lib/locale/lang/zh-CN'

import "./assets/icons"; // icon
import "./permission"; // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import {
  parseTime,
  resetForm,
  addDateRange,
  selectDictLabel,
  selectDictLabels,
  download,
  handleTree,
} from "@/utils/ruoyi";
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar";
// 富文本组件
import Editor from "@/components/Editor";
// 文件上传组件
import FileUpload from "@/components/FileUpload";
// 图片上传组件
import ImageUpload from "@/components/ImageUpload";
// 字典标签组件
import DictTag from "@/components/DictTag";
// 头部标签组件
import VueMeta from "vue-meta";
// 科研算法库的组件
import d2Container from "@/components/d2-container";
import { codemirror } from "vue-codemirror";

import "codemirror/lib/codemirror.css";




// 全局方法挂载
Vue.prototype.getDicts = getDicts;
Vue.prototype.getConfigKey = getConfigKey;
Vue.prototype.parseTime = parseTime;
Vue.prototype.resetForm = resetForm;
Vue.prototype.addDateRange = addDateRange;
Vue.prototype.selectDictLabel = selectDictLabel;
Vue.prototype.selectDictLabels = selectDictLabels;
Vue.prototype.download = download;
Vue.prototype.handleTree = handleTree;

Vue.prototype.msgSuccess = function (msg) {
  this.$message({ showClose: true, message: msg, type: "success" });
};

Vue.prototype.msgError = function (msg) {
  this.$message({ showClose: true, message: msg, type: "error" });
};

Vue.prototype.msgInfo = function (msg) {
  this.$message.info(msg);
};

// // 注意 有些组件使用异步加载会有影响
Vue.component("d2-container", d2Container);
Vue.component("d2-icon", () => import("@/components/d2-icon"));
Vue.component("d2-icon-svg", () =>
  import("@/components/d2-icon-svg/index.vue")
);

// 全局组件挂载
Vue.component("DictTag", DictTag);
Vue.component("Pagination", Pagination);
Vue.component("RightToolbar", RightToolbar);
Vue.component("Editor", Editor);
Vue.component("FileUpload", FileUpload);
Vue.component("ImageUpload", ImageUpload);

Vue.use(d2Admin);
Vue.use(VCharts);
Vue.prototype.$echarts = echarts;
Vue.use(codemirror);
Vue.use(directive);
Vue.use(VueMeta);

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */
// locale.use(elementZh)


Vue.use(ElementUI, { locale });


Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
